#1、在工作台中统一调用测试用例，可以实现一键执行（执行main.py文件就是执行所有的测试用例）
#2、每一条测试脚本都写在try except语句中，避免脚本出错导致脚本停止
#3、利用exc_info可以把报错的信息也输出出来
#4、执行记录应该放在log.txt文件中，方便脚本执行完成之后查看结果
import sys
import os
# print('当前文件的所在目录/',os.path.dirname(__file__))
# curPath = os.path.abspath(os.path.dirname(__file__)) #获取当前文件的所在目录的绝对路径
# print('当前文件的所在目录\,',curPath)  #C:\Users\xhs\Desktop\dbshop项目相关文档2\dbshop1\main
# #将当前文件的所在目录的绝对路径进行分离,分离成C:\Users\xhs\Desktop\dbshop项目相关文档2\dbshop1  和main,存到元组中
# print(os.path.split(curPath))
# rootPath = os.path.split(curPath)[0] #[0]表示元组中的第一个元素
rootPath = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
print(rootPath)
sys.path.append(rootPath) #用python脚本将路径添加到环境变量中

from public.tools import writeLog

#调用并且运行 DBshop001_线下支付流程
try :
    from testCase import DBshop001_线下支付流程
except:
    writeLog("DBshop001_线下支付流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop002_余额支付流程
except:
    writeLog("DBshop002_余额支付流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop003_货到付款流程
except:
    writeLog("DBshop003_货到付款流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop004_取消订单
except:
    writeLog("DBshop004_取消订单 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop005_查询订单_正常订单
except:
    writeLog("DBshop005_查询订单_正常订单 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop006_删除取消的订单
except:
    writeLog("DBshop006_删除取消的订单 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop007_查看发货单
except:
    writeLog("DBshop007_查看发货单 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop008_查看支付记录
except:
    writeLog("DBshop008_查看支付记录 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop009_退货管理搜索
except:
    writeLog("DBshop009_退货管理搜索 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop010_处理退货退款
except:
    writeLog("DBshop010_处理退货退款 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop011_商品管理添加商品
except:
    writeLog("DBshop011_商品管理添加商品 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop012_商品管理搜索商品
except:
    writeLog("DBshop012_商品管理搜索商品 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop013_商品管理分类编辑
except:
    writeLog("DBshop013_商品管理分类编辑 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop014_商品管理删除分类
except:
    writeLog("DBshop014_商品管理删除分类 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop015_添加侧边设置
except:
    writeLog("DBshop015_添加侧边设置 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop016_删除侧边设置
except:
    writeLog("DBshop016_删除侧边设置 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop017_商品管理属性分组
except:
    writeLog("DBshop017_商品管理属性分组 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop018_商品管理删除属性分组
except:
    writeLog("DBshop018_商品管理删除属性分组 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop019_商品管理添加属性
except:
    writeLog("DBshop019_商品管理添加属性 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop020_商品管理删除属性
except:
    writeLog("DBshop020_商品管理删除属性 执行出错")
    writeLog(str(sys.exc_info()[1]))



try :
    from testCase import DBshop021_商品管理添加商品品牌
except:
    writeLog("DBshop021_商品管理添加商品品牌 执行出错")
    writeLog(str(sys.exc_info()[1]))

